#ifndef _KC_SSLCLIENT_H__KC_
#define _KC_SSLCLIENT_H__KC_

#include <string>
#include <openssl/bio.h>
#include "../tcp/TCPClient.h"
#include "../CommError.h"
#include "../CommCommon.h"
#include "SSLCommon.h"

namespace kc_sf
{
	class SSLClient : public TCPClient
	{
		public:

			SSLClient();
			~SSLClient();

			void initSSLContext( );
			void disconnect();

			void recvData( std::string &to, const std::string &until_str, int timeout );
			void sendData( const std::string &what, int timeout );

		private:

			SSL_CTX * cl_ctx;
			SSL * cl_ssl;

			void throwSSLError( CommErrorType type, int err, const std::string &err_msg );
	};
}

#endif // _KC_SSLCLIENT_H__KC_
